
import request from '../../index';

/**
 *  关于系统版本一块的内容
 * @returns 
 */

export function getSystemVersion() {
    return request({
        url: '/api/system/version',
        method: 'get'
    });
}

export function uploadOtaFile(params){
    return request({
        url: '/api/system/upload',
        method: 'post',
        headers: {
            'Content-Type': 'multipart/form-data'
        },
        data: params
    });
}

export function startUpgrade(path) {
    return request({
        url: '/api/system/upgrade',
        method: 'post',
        data:{
            path
        }
    });
}

export function getUpgradeProgress(){
    return request({
        url: '/api/system/upgrade',
        method: 'get',
    })
}

export function setFotaAutoUpdate(auto){
    return request({
        url: '/api/system/fota/auto',
        method: 'post',
        data:{
            auto: auto
        }
    })
}

export function getFotaNewVersion(){
    return request({
        url: '/api/system/fota/version',
        method: 'get',
    })
}

export function startDownloadVersion(new_version){
    return request({
        url: '/api/system/fota/download',
        method: 'post',
        data:{
            version:new_version
        }
    })
}


export function getDownloadProgress(){
    return request({
        url: '/api/system/fota/download',
        method: 'get',
    })
}
